﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IceDog.Lib.Permission
{
    public class PermissionControl
    {
        public int GetPermissionValue(params PermissionValue[] array)
        {
            var perm = 0;
            for (int i = 0; i < array.Length; i++)
            {
                perm |= (int)array[i];
            }
            return perm;
        }

        public bool HasPermission(int permVal, PermissionValue permType)
        {
            var p = (int)permType;
            return (permVal & p) == p;
        }
    }
}
